﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data.OleDb;

namespace Web_HengliSeed.Sys_Manage
{
    public partial class M_ReBackLeave : System.Web.UI.Page
    {
        protected string strLeaveNote = "";
        protected string strLeaveTime = "";
        protected string strLeaveTitle = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            ClassFile.Function.CheckState();
            if (!IsPostBack)
            {
                LoadData();
            }
        }

        private void LoadData()
        {
            string strPID = Common.GetMes.GetRequestQuery(Request, "LID");
            if (!string.IsNullOrEmpty(strPID))
            {
                OleDbDataReader DataRead = BLL.LeaveInfo.GetAllLeaveMes(strPID);
                if (DataRead.HasRows)
                {
                    DataRead.Read();
                    strLeaveTitle = Server.HtmlDecode(DataRead["T_LeaveTitle"].ToString());
                    strLeaveTime = Server.HtmlDecode(DataRead["T_DateTime"].ToString());
                    strLeaveNote = DataRead["T_LeaveNote"].ToString();
                    txtReBackNote.Value = DataRead["T_ReplyNote"].ToString();
                }
                DataRead.Close();
                DataRead.Dispose();
            }
        }
        protected void BtnLeaveSave_Click(object sender, EventArgs e)
        {
            string strPID = Common.GetMes.GetRequestQuery(Request, "LID");
            if (BLL.LeaveInfo.EditLeaveMes(strPID, Server.HtmlEncode(txtReBackNote.Value.Trim())))
            {
                Common.ShowMessage.Show(Page, "suess", "留言回复成功，返回留言列表...", "M_LeaveInfo.aspx");
            }
            else
            {
                Common.ShowMessage.Show(Page, "error", "留言回复失败，请重试或联系技术人员..."); 
            }
        }
    }
}
